package com.atguigu.bean;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Copyright 2025 ZS Network Co., Ltd. All rights reserved.
 * 本文件仅限于正数网络技术有限公司内部传阅，禁止外泄以及用于其他的商业目的。
 * Created by zwn on 2025/7/29.
 *
 * @description:
 */

public class Person {

    /**
     * @value
     * 1.默认是按类型注入
     * 2.@Value("${person.name}")  配置文件中的值
     * 3.SpEL  #{}
     */
    @Value("张三")
    private String userName;


    @Value("#{20-2}")
    private Integer age;
    
    @Value("${person.NickName}")
    private String nickName;



  
    
    public Person(String userName) {
        this.userName = userName;
    }

    public Person() {

    }

    public Person(String userName, Integer age) {
        System.out.println("构建person.ddd...");

        this.userName = userName;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +

                " userName='" + userName + '\'' +
                ", age=" + age +
                ", nickName='" + nickName + '\'' +
                '}';
    }


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }
}
